#include <errno.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <libusb.h>


struct libusb_device_handle *devh = NULL;

static int find_dpfp_device(void)
{
	devh = libusb_open_device_with_vid_pid(NULL, 0x045e, 0x02b0);
	return devh ? 0 : -EIO;
}

int main(void){
	int r = 1;
		
	r = libusb_init(NULL);
	if (r < 0) {
		fprintf(stderr, "failed to initialise libusb\n");
		exit(1);
	}
	
	r = find_dpfp_device();
	if (r < 0) {
		fprintf(stderr, "Could not find/open device\n");
		exit(1);
	}
		
	r = libusb_claim_interface(devh ,0);
	if( r < 0){
	fprintf(stderr, "usb_claim_interface error %d\n", r);
		printf("Step 2 exit");
		exit(0);
	}	
	char arr;	
	int k;
						     //0xffd0 for down	
	k = libusb_control_transfer(devh, 0x40 , 0x31, 0xfff0, 0, &arr, 0, 0);
	printf("%d\n", k);
}
